package com.zpark.component;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @PackageName: com.zpark.component
 * @ClassName: Producer
 * @Description:
 * @author: RZS
 * @date: 2022/12/13  17:33
 */
@Component
public class Producer {

    @Autowired
    private AmqpTemplate amqpTemplate;

    public void send() {
        String msg = "Hello";
        System.out.println("生产者：发送 msg -> " + msg);
        amqpTemplate.convertAndSend("simple_queue", msg);
    }
}
